Method for determining output data for a plurality of text documents

ABSTRACT

Provided is a method for determining output data for a plurality of text documents, including the steps of: providing a feature matrix as input data ; wherein the feature matrix includes information about frequencies of a plurality of features within the plurality of text documents; clustering the feature matrix using a clustering algorithm into at least one clustering matrix ; wherein the at least one clustering matrix includes information about the cluster membership of each document of the plurality of documents or each feature of the plurality of features, assigning at least one score to each feature of the plurality of features based on the at least one clustering matrix; ranking the plurality of features based on their assigned scores; and outputting the ranked features as output data. A corresponding computer program product and system is also provided.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority to European application No. 18168202.2,having a filing date of Apr. 19, 2018, the entire contents of which arehereby incorporated by reference.

FIELD OF TECHNOLOGY

The following relate to a computer-implemented method for determiningoutput data for a plurality of text documents, a corresponding systemand computer program product. The technical field relates to NaturalLanguage Processing (NLP).

BACKGROUND

The annotation of unlabelled text documents is known from the prior art.The annotation can also be interpreted as the determination of metadata. Further, the unlabelled text documents can be defined as documentsin text format which do not have any kind of meta data. Thereby, themeta data includes data about e.g. categorical or classificationinformation, concepts, themes, topics and any other content informationwhich occurs in the text documents. Furthermore, the meta data alsoincludes e.g. the words, phrases and any other expressions which arerelated to or typical for the aforementioned meta data, which may or maynot occur in the given document. Thus, the first type of the meta datacan be noted as concept and the other type of the concept related metadata as concept expression in the following.

Accordingly, usually, this meta data is not available for a user orreader of the text documents. This lack of meta data is a disadvantagefor the reader since the data is important for several reasons. Thewords and phrases e.g. give an overview of the topics in the textdocuments and indicate their relative importance. Moreover, the metadata can be used to perform a subsequent analysis on the text documents.This subsequent analysis is important to get the relevant meaning of thecontent of the text documents.

Usually, according to prior art, the annotation of the unlabelled textdocuments is performed manually. In this case, an expert determines theconcepts as first type of meta data expected to be encountered in thegiven text documents. Then, the expert also determines the contentexpressions as second type of meta data related to the concepts in asimilar manner. Thereafter, an iterative process of annotation andreview can follow to validate the expert's annotation results. However,the disadvantage is that the manual annotation by the expert is based onsubjective information, is time-consuming and error-prone.

Moreover, the experts have to deal with an increasing amount of textdocuments. Those large or voluminous data sets are known under the terms“big data” or “large scale data”. The manual analysis of big databecomes unfeasible for the experts.

Thus, the importance of automated large scale data analysis or dataprocessing will in-crease in the future. This analysis or processingparadigm encompasses a series of different methods and systems toprocess big data. However, so far, traditional data processingapplication software does not deal with them adequately. Big datachallenges include in particular capturing data, data storage, dataanalysis, search, sharing, transfer, visualization, querying, updating,information privacy and data source.

There is no automated method available to date for determining meta datafor text documents on a large scale in an automated manner.

SUMMARY

An aspect relates to a method for determining output data for aplurality of text documents in an efficient and reliable manner.

The method for determining output data for a plurality of text documentscomprises the steps of:

-   -   a. providing a feature matrix as input data; wherein    -   b. the feature matrix comprises information about frequencies of        a plurality of features within the plurality of text documents;    -   c. clustering the feature matrix using a clustering algorithm        into at least one clustering matrix; wherein p2 the at least one        clustering matrix comprises information about the cluster        membership of each document of the plurality of documents or        each feature of the plurality of features,    -   d. assigning at least one score to each feature of the plurality        of features based on the at least one clustering matrix;    -   e. ranking the plurality of features based on their assigned        scores; and    -   f. outputting the ranked features as output data.

The embodiments of the invention are directed to a method fordetermining output data for a plurality of text documents. Thereby, thetext documents are in particular the aforementioned unlabelled textdocuments without any meta data. The text documents are in particularavailable as big data.

First, a feature matrix is used as input for a clustering algorithm inorder to cluster the feature matrix into at least one clustering matrixas output. In other words, the values of the feature matrix are used tocluster the documents. The feature can be any kind of numericinformation related to the text documents. Thereby, each row of thefeature matrix comprises the information for a single text document.

Additionally to the feature matrix, known features which are expected tooccur in the text documents can be provided as additional input for theclustering algorithm.

Then, the one or more clustering matrices are used as input for scoringand ranking the features into a ranked list of features. For example,one matrix can be a document representation matrix and another matrixcan be a feature representation matrix. One of those matrices or bothmatrices can be used for the next method steps. Then, a score iscalculated for each feature using the one or more clustering matrices.The features are ranked by their scores. This has the advantage thatfeatures with higher importance for characterizing the concept at handare ranked higher in the output data.

The method enables data processing of unlabelled text documents in afully automated and efficient manner. No expert knowledge is requiredany more to process a large set of text documents, big data. Thus, themethod according to the embodiments of the invention advantageously hassignificant cost savings compared to prior art.

The method according to the embodiments of the invention uses frequencyinformation in an intermediate processing step to construct thefrequency matrix. Contrary to prior art approaches, this information isadditionally considered but not solely used to compute the scores forthe features. Thus, the scores according to the embodiments of theinvention are more likely to reflect the true relative importance of thefeatures since they are computed in relation to the concepts which occurin the text documents.

In one aspect the cluster is associated with a first meta data set,comprising at least one element selected from the group, comprising: acategorical or classification information, a concept, a theme, a topicand any other content information associated with at least one textdocument of the plurality of text documents.

In one aspect the feature is associated with a second meta data set,comprising at least one element selected from the group, comprising: aword, a phrase and any other expression which is associated with thefirst meta data set.

In another aspect the output data comprises the first meta data setand/or the second meta data set.

Accordingly, the text documents can be divided into distinct meta datasets. To avoid repetition, reference is made to the aforementioneddefinitions.

For example, the term “feature” can be interpreted as conceptexpression. The concept expression refers to an expression, a term, aword, a phrase or a product name which can occur in a text document. Thetext documents can be clustered according to some salient content of thetext document into clusters. The term “cluster” can be interpreted as aconcept. A single text document can have partial membership of manyclusters, wherein each cluster is characterized by many features.

In another aspect, the step of providing comprises the steps of:

-   -   processing each text document of the plurality of text documents        into according sequences of tokens based on the text structure        of the text document;    -   converting each sequence of tokens of the plurality of sequences        of tokens into according features based on an extraction of        sub-sequences of the sequence of tokens;    -   assembling the plurality of features into the feature matrix        based on the occurrence of the plurality of features among the        plurality of text documents.

Accordingly, the feature matrix is generated by three steps:preprocessing, feature extraction and feature matrix construction. Inthe second step, the sequences of tokens are processed, according towhich the sequences of tokens are split into overlapping and/ornonoverlapping subsequences. For example, in a set of newspaper textsone feature might be “finance” and the set of features which indicatesthis cluster might include “inflation”, “interest rate” or governmentbonds“. Thus, the sequence “Interest rate” is e.g. split into “Interest”and “rate”. Accordingly, the sequences of tokens are processed,according to which the sequences of tokens are split into overlapping ornon-overlapping subsequences.

In another aspect, the extraction of sub-sequences is an n-gramextraction. Accordingly, distinct methods can be applied, in particularn-gram extraction. Alternatively, plain tokens of the text document canbe used, without grouping them into n-grams of length greater than one.Alternatively, a dictionary of known phrases can be used. The n-gramextraction has the advantage that no prior knowledge or linguisticresources such as dictionaries are required. Further, n-grams cancapture multi-word expressions which characterize the subject at hand.

In another aspect, the assembly comprises the steps of:

-   -   determining the frequency of each feature of the plurality of        features within each text document of the plurality of text        documents; and/or    -   determining the features of the plurality of features occurring        at least once in at least one text document of the plurality of        text documents and/or their according frequencies among the        plurality of text documents.

Accordingly, the occurrence and frequency of the features within asingle document and across the plurality of documents is considered forthe assembly. This assembly is advantageous since the documents arerepresented in the input as numeric vectors of frequency values, whichallows general-purpose clustering algorithms to be used. The featurematrix can be efficiently computed and stored in computer memory.

In another aspect, the at least one matrix is a weight matrix, whereinthe weight matrix is associated with the plurality of text documents orwith the plurality of features. This way both the weight of the featureand the size of the clusters it occurs in contribute to the ranking ofthat feature in the output data.

In another aspect, the clustering algorithm is a non-negative matrixfactorization (NMF) algorithm. Accordingly, distinct methods can beapplied, in particular the NMF-algorithm. Other alternative clusteringmethods which take a feature matrix as input include k-means and nearestneighbour. NMF has the advantage that it produces explicit interpretableoutputs which allow the inspection of the relative importance offeatures.

In another aspect, the features of the plurality of features havingscores above a specified threshold are extracted for step e.Accordingly, the weights of the features of the clustering matrices areused to compute the scores of the features. The scoring method takesinto account both the weight of the feature in the featurerepresentation matrix and the relative size of the cluster it occurs in.This allows the ranking which the embodiments of the invention outputsto reflect relative importance of features in the context of theconcepts which they characterize.

Further, the embodiments of the invention are directed to a computerprogram product (non-transitory computer readable storage medium havinginstructions, which when executed by a processor, perform actions),directly loadable into internal memory of a computer, comprisingsoftware code portions for performing the steps of the aforementionedmethod when said computer program product is running on a computer.

Further, the embodiments of the invention are directed to a system fordetermining output data for a plurality of text documents, comprising:

-   -   a. means for providing a feature matrix as input data; wherein    -   b. the feature matrix comprises information about frequencies of        a plurality of features within the plurality of text documents;    -   c. means for clustering the feature matrix using a clustering        algorithm into at least one clustering matrix; wherein        -   the at least one clustering matrix comprises information            about he cluster membership of each document of the            plurality of documents or each feature of the plurality of            features,    -   d. means for assigning at least one score to each feature of the        plurality of features based the at least one clustering matrix;    -   e. means for ranking the plurality of features based on their        assigned scores; and    -   f. means for outputting the ranked features as output data.

BRIEF DESCRIPTION

Some of the embodiments will be described in detail, with references tothe following Figures, wherein like designations denote like members,wherein:

FIG. 1 shows a flow chart of the method in accordance with embodimentsof the invention;

FIG. 2 shows exemplary matrices according to an embodiment of theinvention;

FIG. 3 shows exemplary output data according to an embodiment of theinvention; and

FIG. 4 shows exemplary output data according to an embodiment of theinvention.

DETAILED DESCRIPTION

The flow chart of the method in accordance with embodiments of theinvention is illustrated in FIG. 1. The method steps S1 to S5 will beexplained in more detail in the following.

Preprocessing

First, the content of each text document is converted into a sequence ofindividual tokens. Thereby, the tokens correspond to words. Therefore,distinct standard methods of e.g. stopword removal and tokenization canbe applied. Stopword removal removes auxiliary words. Tokenizationsplits the text of the text documents into words at whitespace andpunctuation boundaries.

Feature Extraction

Then, each token sequence is converted into features 12. Thereby n-gramextraction can be applied. In this case, each subsequence whose lengthis within a configurable range is computed. For example, the range 1 . .. 3, can be used for extracting all individual words, word pairs andword triples. Any given expression or term may occur multiple times in asingle text document. This results in a multiset of features for eachtext document.

Feature Matrix Generation

Then, the multiset of features 12 is assembled into a feature matrix 10,S1. The feature matrix 10 can also be referred to as term-frequencymatrix. First, the frequency of each feature 12 within each textdocument is computed, from which the “term frequency/inverse documentfrequency” (tf-idf) score of each expression in each document iscomputed, as described further above. Further, the vocabulary of theplurality of text documents is computed. The vocabulary corresponds tothe list of all features which occur at least once in any text document.

Accordingly, the feature matrix 10 is a matrix V of size n×f, wherein nis the number of text documents and f is the number of features 12 inthe vocabulary. Each cell i,j of the feature matrix contains the tf-idfscore of the jth feature in the ith text document. This score is zero,if the feature 12 does not occur in the text document.

Clustering via NMF

Then, the NMF algorithm is applied on the feature matrix 10 as the inputV, S2. A configurable parameter k controls the number of clusters intowhich the text documents are clustered. The resulting matrices W and Hcan be stored in a suitable data storage unit as clustering matrices 20,30 and are illustrated in FIG. 2. Thereby, W corresponds to the documentrepresentation matrix and H to the feature representation matrix. Therows of H correspond to the clusters and the columns to features.

Computation of Scores for the Features

Then, a score is computed for each feature based on the content of thematrices W and H, S3. First, H is normalized row-wise, such that therows of H sum up to one and all values are in the range 0 . . . 1. Then,those cells from H are extracted, whose values are above a configurablethreshold. For example, a baseline value for this threshold is 0.0001,which results in the removal of those cells whose value is very close tozero and thus unimportant for that row. The resulting scored featuresare shown in FIG. 3.

Ranking the Features Based on the Scores

Then, the features 12 are ranked according to the scores S4. The mostmeaningful features 12 of are those which have the highest sum ofscores. Accordingly, the features 12 which occur in many clusters aremore important, and those which have a higher weight within a clusterare more important.

Therefore, the “total score” for a feature 12 is calculated as the sumof all scores in the result set which have been attributed to thatfeature. The resulting ranked features are shown in FIG. 4. Thus, theresult is a ranked list of scored features for the text documents and isoutputted S5. The ranked list can be e.g. stored, visualized ortransmitted.

As illustrated, the score for the exemplary feature “interest rate” is0.51, corresponding to the sum of its scores for its occurrences in theclusters “finance” and “technology”.

Additionally or alternatively other clustering- scoring- andranking-algorithms can be applied.

Non-Negative Matrix Factorization (NMF)

The NMF algorithm can be regarded as kind of compression. It finds alower-dimensional representation of the input data and can be appliedwhere all values in the input matrix are non-negative. Thus, the NMF isa good fit for text feature frequencies. Given the required number ofclusters k, the algorithm factorizes the input matrix V into twomatrices H and W such that V is approximately equal to W×H. The combinedsize of W and H is considerably smaller than the size of V.

As shown in FIG. 2, the exemplary NMF considers four documents and twoclusters.

The matrix W is of size n×k, where n is the number documents and k isthe configured number of clusters. Each row of W is a k-dimensionalvector for an input document. This vector is the latent representationof the document and can be interpreted as the distribution ofprobability of membership of each cluster. The largest value in thevector determines the cluster to which the document most likely belongs.

The H matrix is of size k×f, where k is the number of clusters and f isthe number of features in the input data. Each row of H corresponds to acluster and each column to a feature in the input space. The values of Hare feature weightings for the respective clusters. Those features whichhave the highest values in some row of the matrix H are the featureswhich are most important for the cluster represented by that row.

Although the present invention has been disclosed in the form ofpreferred embodiments and variations thereon, it will be understood thatnumerous additional modifications and variations could be made theretowithout departing from the scope of the invention.

For the sake of clarity, it is to be understood that the use of ‘a’ or‘an’ throughout this application does not exclude a plurality, and‘comprising’ does not exclude other steps or elements.

1. A method for determining output data for a plurality of textdocuments, the method comprising: providing a feature matrix as inputdata, wherein, the feature matrix comprises information aboutfrequencies of a plurality of features within the plurality of textdocuments; clustering the feature matrix using a clustering algorithminto at least one clustering matrix, wherein the at least one clusteringmatrix comprises information about a cluster membership of each documentof the plurality of documents or each feature of the plurality offeatures; assigning at least one score to each feature of the pluralityof features based on the at least one clustering matrix; ranking theplurality of features based on their assigned scores; and outputting theranked plurality of features as output data.
 2. The method according toclaim 1, wherein the cluster is associated with a first meta data set,comprising at least one element selected from the group, comprising: acategorical or classification information, a concept, a theme, a topicand any other content information associated with at least one textdocument of the plurality of text documents.
 3. The method according toclaim 2, wherein the feature is associated with a second meta data set,comprising at least one element selected from the group, comprising: aword, a phrase and any other expression which is associated with thefirst meta data set.
 4. The method according to claim 3, wherein theoutput data comprises the first meta data set and/or the second metadata set.
 5. The method according to claim 1, wherein the step ofproviding comprises: processing each text document of the plurality oftext documents into according sequences of tokens based on a textstructure of the text document; converting each sequence of tokens ofthe sequences of tokens into according features based on an extractionof sub-sequences of the sequences of tokens; and assembling theplurality of features into the feature matrix based on an occurrence ofthe plurality of features among the plurality of text documents.
 6. Themethod according to claim 5, wherein the extraction of sub-sequences isan n-gram extraction.
 7. The method according to claim 5, wherein theassembly comprises: determining a frequency of each feature of theplurality of features within each text document of the plurality of textdocuments; and/or determining features of the plurality of featuresoccurring at least once in at least one text document of the pluralityof text documents and/or according frequencies among the plurality oftext documents.
 8. The method according to claim 1, wherein the at leastone matrix is a weight matrix, further wherein the weight matrix isassociated with the plurality of text documents or with the plurality offeatures.
 9. The method according to claim 1, wherein the clusteringalgorithm is a non-negative matrix factorization—algorithm.
 10. Themethod according to claim 1, wherein features of the plurality offeatures having scores above a specified threshold are extracted forstep e.
 11. A computer program product, comprising a computer readablehardware storage device having computer readable hardware storage devicehaving computer readable program code stored therein, said program codeexecutable by a processor of a computer system to implement a methodaccording to claim 1 when said computer program product is running on acomputer.
 12. A system for determining output data for a plurality oftext documents, comprising: a means for providing a feature matrix asinput data, wherein the feature matrix comprises information aboutfrequencies of a plurality of features within the plurality of textdocuments; a means for clustering the feature matrix using a clusteringalgorithm into at least one clustering matrix, wherein the at least oneclustering matrix comprises information about a cluster membership ofeach document of the plurality of documents or each feature of theplurality of features; a means for assigning at least one score to eachfeature of the plurality of features based on the at least oneclustering matrix; a means for ranking the plurality of features basedon their assigned scores ; and a means for outputting the rankedplurality of features as output data.
 13. The system according claim 12,wherein the means for providing and means for outputting are designed asat least one interface.